// Mongoose的一切都始于一个Schema。每个schema映射到MongoDB的集合(collection)和定义该集合(collection)中的文档的形式
const mongoose = require('mongoose')

const schema = new mongoose.Schema({
    name:{type : String},
    avatar:{type : String},
    banner:{type:String},
    title:{type:String},
    // 实现多选
    categories:[{type:mongoose.SchemaTypes.ObjectId,ref:'Category'}],
    // 评分
    scores:{
        difficult:{type:Number},
        attack:{type:Number},
        survive:{type:Number},
        skills:{type:Number},
    },
    // 多个技能
    skills:[{
        icon:{type:String},
        tips:{type:String},
        delay:{type:String},
        cost:{type:String},
        description:{type:String},
        name:{type:String},
    }],
    items1:[{type:mongoose.SchemaTypes.ObjectId,ref:'Item'}],
    items2:[{type:mongoose.SchemaTypes.ObjectId,ref:'Item'}],
    usageTips:{type:String},
    battleTips:{type:String},
    teamTips:{type:String},
    partners:[{
        hero:{type:mongoose.SchemaTypes.ObjectId,ref:'Hero'},
        description:{type:String}
    }]

    
})

 
module.exports = mongoose.model('Hero',schema)